<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<form action="http://www.test8899.com/reg.php" method="post">
			<table border="1" cellspacing="0" cellpadding="5px" id="checkid">
				<tr>
					<th></th>
					<th>姓名</th>
					<th>性别</th>
					<th>年龄</th>
					<th>家庭住址</th>
				</tr>
				<tr>
					<td><input type="checkbox" name="boy" id="" value="1" /></td>
					<td>张三</td>
					<td>男</td>
					<td>15</td>
					<td>新罗</td>
				</tr>
				<tr>
					<td><input type="checkbox" name="boy" id="" value="2" /></td>
					<td>李四</td>
					<td id="">男</td>
					<td>16</td>
					<td>北京</td>
				</tr>
				<tr>
					<td><input type="checkbox" name="gril" id="" value="3" /></td>
					<td>王五</td>
					<td id="">女</td>
					<td>15</td>
					<td>天津</td>
				</tr>
				<tr>
					<td><input type="checkbox" name="boy" id="" value="4" /></td>
					<td>麻子</td>
					<td>男</td>
					<td>17</td>
					<td>长沙</td>
				</tr>
				<tr>
					<td><input type="checkbox" name="gril" id="" value="5" /></td>
					<td>小红</td>
					<td>女</td>
					<td>16</td>
					<td>湖南</td>
				</tr>
			</table>
			<td><input type="checkbox" name="" id="checkall" value="" onclick="a()"/></td>全选
			<td><input type="checkbox" name="" id="checkman" value="" onclick="b()"/></td>全选男
			<td><input type="checkbox" name="" id="checkwoman" value="" onclick="c()"/></td>全选女
			<button type="submit">删除</button>
		</form>
	</body>
	<script type="text/javascript">
		function a(){
			var c=document.getElementById('checkid')
			var d=c.getElementsByTagName('input')
			var e=document.getElementById('checkall')
			for (var i=0 ; i<d.length ; i++) {
				d[i].checked=e.checked;
			}
		}
		function b(){
			var dd=document.getElementsByName('boy')
			var ee=document.getElementById('checkman')
			for (var i=0 ; i<dd.length ; i++) {
				dd[i].checked=ee.checked;
			}
		}
		function c(){
			var de=document.getElementsByName('gril')
			var ed=document.getElementById('checkwoman')
			for (var i=0 ; i<de.length ; i++) {
				de[i].checked=ed.checked;
			}
		}
	</script>
</html>
